package com.shoppingmall.mapper;


import com.shoppingmall.model.Goods;
import org.apache.ibatis.annotations.Delete;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Select;
import org.apache.ibatis.annotations.Update;
import org.springframework.stereotype.Repository;

import java.util.List;
@Repository
public interface GoodsMapper {

    List<Goods> queryGood(Integer...isDisplay);
    @Select("select * from tbl_goods where goods_display=0 and goods_id=#{goods_id}")
    Goods queryGoodById(int goods_id);
    @Insert("insert into tbl_goods values (default ,#{goods_name},#{goods_kind},#{goods_image},#{goods_price},#{goods_desc},#{goods_display},#{goods_nums},#{suser_id})")
    void addGoods(Goods goods);
    @Update("update tbl_goods set goods_name=#{goods_name},goods_kind=#{goods_kind},goods_image=#{goods_image},goods_price=#{goods_price},goods_desc=#{goods_desc},goods_display=#{goods_display},goods_nums=#{goods_nums},suser_id=#{suser_id} where goods_id=#{goods_id}")
    void updateGoods(Goods goods);

    void delGoods(int...goods_ids);

    List<Goods> queryGoodsByName(String goods_name);
    @Select("select * from tbl_goods where goods_display=0 and goods_kind=#{goods_kind}")
    List<Goods> queryGoodsByKind(int goods_kind);
    @Update("update tbl_goods set goods_display=#{goods_display} where goods_id=#{goods_id}")
    void updatemangerGoods(int goods_display, int goods_id);

    List<Goods> mangerqueryGood(int goods_display);
}
